<template>
  <div class="easyd-weixin-Box">
    <div class="addServiceheader">
      <div class="addServiceBtn" @click="goAddService">
        <i class="fa fa-credit-card fa-lg"></i>新增服务卡
      </div>
    </div>
    <div class="serviceManagerBox">
        <mt-loadmore
        :top-method="loadTop"
        :bottom-method="loadBottom"
        :bottom-all-loaded="allLoaded"
        ref="loadmore"
      >
        <div class="serviceManagerItem" v-for="i in 10">
            <img :src="imageDemoUrl" v-lazy="imageDemoUrl" v-gallery>
            <div class="serviceManagerMenu">
            <div class="serviceManagerMenuItem">
                <i class="fa fa-edit fa-lg"></i>编辑
            </div>
            <div class="serviceManagerMenuItem">
                <i class="fa fa-trash fa-lg"></i>删除
            </div>
            <div class="serviceManagerMenuItem">
                <i class="fa fa-paw fa-lg"></i>关注
            </div>
            <div class="serviceManagerMenuItem">
                <i class="fa fa-paper-plane fa-lg"></i>浏览
            </div>
            </div>
        </div>
        </mt-loadmore>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      allLoaded: false,
      imageDemoUrl:
        "http://testfileupload.oss-cn-beijing.aliyuncs.com/hengtu2.jpeg"
    };
  },
  methods: {
    loadTop() {
      setTimeout(() => {
        this.$refs.loadmore.onTopLoaded();
      }, 2000);
    },
    loadBottom() {
      setTimeout(() => {
        this.allLoaded = true;
        this.$refs.loadmore.onBottomLoaded();
      }, 5000);
    },
    goAddService(){
      this.$router.push({
        path : '/addService'
      })
    }
  }
};
</script>

<style lang="stylus" scoped>
@import '~PUBLIC_CSS'
.addServiceheader {
  width: 100%;
  height: 50px;
  padding: 0px 15px 0px 15px;
  margin-top: 15px;
  box-sizing: border-box;

  .addServiceBtn {
    width: 100%;
    height: 50px;
    text-align: center;
    line-height: 50px;
    $itemStyle()

    i {
      color: #999;
      font-size: 14px;
      position: relative;
      top: -2px;
      right: 10px;
    }
  }
}

.serviceManagerBox {
  position: absolute;
  top: 80px;
  bottom: 0px;
  left: 0px;
  box-sizing: border-box;
  padding-left: 15px;
  padding-right: 15px;
  overflow auto
  -webkit-overflow-scrolling : touch;
  right: 0px;

  .serviceManagerItem {
    width: 100%;
    height: auto;
    margin-bottom: 15px;
    $itemStyle()

    .serviceManagerMenu {
      width: 100%;
      height: 50px;
      display: flex;
      background: #fff;
      justify-content: space-between;
      margin-top: -4px;
      border-bottom-left-radius: 5px;
      border-bottom-right-radius: 5px;

      .serviceManagerMenuItem {
        flex: 1;
        height: 50px;
        text-align: center;
        line-height: 48px;

        i {
          color: #999;
          font-size: 16px;
          position: relative;
          top: -1px;
          right: 5px;
        }
      }
    }

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-top-left-radius: 5px;
      border-top-right-radius: 5px;
    }
  }
}
</style>

